﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AirSystem
{
    public class FightDTO
    {
        public string ID { get; set; }
        public string DepartsTime { get; set; }
        public string ArrivesTime { get; set; }
        public List<Ticket> Tickets { get; set; }
        public Ticket MinPrice { get; set; }

        public FightDTO()
        {
            Tickets = new List<Ticket>();
            MinPrice = new Ticket();
        }

        public void setMinTicket()
        {
            var query = from ticket in Tickets
                        where ticket.Price.IndexOf('H')<0
                        select ticket;
            MinPrice = query.FirstOrDefault();

            foreach (Ticket item in Tickets)
            {
                if (item.Price.IndexOf('H') < 0)
                {
                    if (item.CompareTo(MinPrice) <0)
                    {
                        MinPrice = item;
                    }
                }
            }
        }

    }
}
